home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Bank smakow / BankSmakow.air / BankSmakow.swf / scripts / mx / utils / ObjectUtil.as < prev    next >
Text File  |  2009-12-16  |  28KB  |  897 lines

  1. package mx.utils
  2. {
  3.    import flash.utils.ByteArray;
  4.    import flash.utils.Dictionary;
  5.    import flash.utils.getQualifiedClassName;
  6.    import flash.xml.XMLNode;
  7.    import mx.collections.IList;
  8.    import mx.core.mx_internal;
  9.    
  10.    use namespace mx_internal;
  11.    
  12.    public class ObjectUtil
  13.    {
  14.       
  15.       private static var defaultToStringExcludes:Array = ["password","credentials"];
  16.       
  17.       private static var CLASS_INFO_CACHE:Object = {};
  18.       
  19.       mx_internal static const VERSION:String = "3.5.0.12683";
  20.       
  21.       private static var refCount:int = 0;
  22.        
  23.       
  24.       public function ObjectUtil()
  25.       {
  26.          super();
  27.       }
  28.       
  29.       public static function isSimple(param1:Object) : Boolean
  30.       {
  31.          var _loc2_:* = typeof param1;
  32.          switch(_loc2_)
  33.          {
  34.             case "number":
  35.             case "string":
  36.             case "boolean":
  37.                return true;
  38.             case "object":
  39.                return param1 is Date || param1 is Array;
  40.             default:
  41.                return false;
  42.          }
  43.       }
  44.       
  45.       private static function internalToString(param1:Object, param2:int = 0, param3:Dictionary = null, param4:Array = null, param5:Array = null) : String
  46.       {
  47.          var str:String = null;
  48.          var classInfo:Object = null;
  49.          var properties:Array = null;
  50.          var isArray:Boolean = false;
  51.          var isDict:Boolean = false;
  52.          var prop:* = undefined;
  53.          var j:int = 0;
  54.          var id:Object = null;
  55.          var value:Object = param1;
  56.          var indent:int = param2;
  57.          var refs:Dictionary = param3;
  58.          var namespaceURIs:Array = param4;
  59.          var exclude:Array = param5;
  60.          var type:String = value == null ? "null" : typeof value;
  61.          switch(type)
  62.          {
  63.             case "boolean":
  64.             case "number":
  65.                return value.toString();
  66.             case "string":
  67.                return "\"" + value.toString() + "\"";
  68.             case "object":
  69.                if(value is Date)
  70.                {
  71.                   return value.toString();
  72.                }
  73.                if(value is XMLNode)
  74.                {
  75.                   return value.toString();
  76.                }
  77.                if(value is Class)
  78.                {
  79.                   return "(" + getQualifiedClassName(value) + ")";
  80.                }
  81.                classInfo = getClassInfo(value,exclude,{
  82.                   "includeReadOnly":true,
  83.                   "uris":namespaceURIs
  84.                });
  85.                properties = classInfo.properties;
  86.                str = "(" + classInfo.name + ")";
  87.                if(refs == null)
  88.                {
  89.                   refs = new Dictionary(true);
  90.                }
  91.                try
  92.                {
  93.                   id = refs[value];
  94.                   if(id != null)
  95.                   {
  96.                      str += "#" + int(id);
  97.                      return str;
  98.                   }
  99.                }
  100.                catch(e:Error)
  101.                {
  102.                   return String(value);
  103.                }
  104.                if(value != null)
  105.                {
  106.                   str += "#" + refCount.toString();
  107.                   refs[value] = refCount;
  108.                   ++refCount;
  109.                }
  110.                isArray = value is Array;
  111.                isDict = value is Dictionary;
  112.                indent += 2;
  113.                j = 0;
  114.                while(j < properties.length)
  115.                {
  116.                   str = newline(str,indent);
  117.                   prop = properties[j];
  118.                   if(isArray)
  119.                   {
  120.                      str += "[";
  121.                   }
  122.                   else if(isDict)
  123.                   {
  124.                      str += "{";
  125.                   }
  126.                   if(isDict)
  127.                   {
  128.                      str += internalToString(prop,indent,refs,namespaceURIs,exclude);
  129.                   }
  130.                   else
  131.                   {
  132.                      str += prop.toString();
  133.                   }
  134.                   if(isArray)
  135.                   {
  136.                      str += "] ";
  137.                   }
  138.                   else if(isDict)
  139.                   {
  140.                      str += "} = ";
  141.                   }
  142.                   else
  143.                   {
  144.                      str += " = ";
  145.                   }
  146.                   try
  147.                   {
  148.                      str += internalToString(value[prop],indent,refs,namespaceURIs,exclude);
  149.                   }
  150.                   catch(e:Error)
  151.                   {
  152.                      str += "?";
  153.                   }
  154.                   j++;
  155.                }
  156.                indent -= 2;
  157.                return str;
  158.                break;
  159.             case "xml":
  160.                return value.toXMLString();
  161.             default:
  162.                return "(" + type + ")";
  163.          }
  164.       }
  165.       
  166.       public static function getClassInfo(param1:Object, param2:Array = null, param3:Object = null) : Object
  167.       {
  168.          var n:int = 0;
  169.          var i:int = 0;
  170.          var result:Object = null;
  171.          var cacheKey:String = null;
  172.          var className:String = null;
  173.          var classAlias:String = null;
  174.          var properties:XMLList = null;
  175.          var prop:XML = null;
  176.          var metadataInfo:Object = null;
  177.          var classInfo:XML = null;
  178.          var numericIndex:Boolean = false;
  179.          var key:* = undefined;
  180.          var p:String = null;
  181.          var pi:Number = NaN;
  182.          var uris:Array = null;
  183.          var uri:String = null;
  184.          var qName:QName = null;
  185.          var j:int = 0;
  186.          var obj:Object = param1;
  187.          var excludes:Array = param2;
  188.          var options:Object = param3;
  189.          if(obj is ObjectProxy)
  190.          {
  191.             obj = ObjectProxy(obj).object_proxy::object;
  192.          }
  193.          if(options == null)
  194.          {
  195.             options = {
  196.                "includeReadOnly":true,
  197.                "uris":null,
  198.                "includeTransient":true
  199.             };
  200.          }
  201.          var propertyNames:Array = [];
  202.          var dynamic:Boolean = false;
  203.          if(typeof obj == "xml")
  204.          {
  205.             className = "XML";
  206.             properties = obj.text();
  207.             if(properties.length())
  208.             {
  209.                propertyNames.push("*");
  210.             }
  211.             properties = obj.attributes();
  212.          }
  213.          else
  214.          {
  215.             classInfo = DescribeTypeCache.describeType(obj).typeDescription;
  216.             className = classInfo.@name.toString();
  217.             classAlias = classInfo.@alias.toString();
  218.             dynamic = classInfo.@isDynamic.toString() == "true";
  219.             if(options.includeReadOnly)
  220.             {
  221.                properties = classInfo..accessor.(@access != "writeonly") + classInfo..variable;
  222.             }
  223.             else
  224.             {
  225.                properties = classInfo..accessor.(@access == "readwrite") + classInfo..variable;
  226.             }
  227.             numericIndex = false;
  228.          }
  229.          if(!dynamic)
  230.          {
  231.             cacheKey = getCacheKey(obj,excludes,options);
  232.             result = CLASS_INFO_CACHE[cacheKey];
  233.             if(result != null)
  234.             {
  235.                return result;
  236.             }
  237.          }
  238.          result = {};
  239.          result["name"] = className;
  240.          result["alias"] = classAlias;
  241.          result["properties"] = propertyNames;
  242.          result["dynamic"] = dynamic;
  243.          result["metadata"] = metadataInfo = recordMetadata(properties);
  244.          var excludeObject:Object = {};
  245.          if(excludes)
  246.          {
  247.             n = excludes.length;
  248.             i = 0;
  249.             while(i < n)
  250.             {
  251.                excludeObject[excludes[i]] = 1;
  252.                i++;
  253.             }
  254.          }
  255.          var isArray:Boolean = className == "Array";
  256.          var isDict:Boolean = className == "flash.utils::Dictionary";
  257.          if(isDict)
  258.          {
  259.             for(key in obj)
  260.             {
  261.                propertyNames.push(key);
  262.             }
  263.          }
  264.          else if(dynamic)
  265.          {
  266.             for(p in obj)
  267.             {
  268.                if(excludeObject[p] != 1)
  269.                {
  270.                   if(isArray)
  271.                   {
  272.                      pi = parseInt(p);
  273.                      if(isNaN(pi))
  274.                      {
  275.                         propertyNames.push(new QName("",p));
  276.                      }
  277.                      else
  278.                      {
  279.                         propertyNames.push(pi);
  280.                      }
  281.                   }
  282.                   else
  283.                   {
  284.                      propertyNames.push(new QName("",p));
  285.                   }
  286.                }
  287.             }
  288.             numericIndex = isArray && !isNaN(Number(p));
  289.          }
  290.          if(!(isArray || isDict || className == "Object"))
  291.          {
  292.             if(className == "XML")
  293.             {
  294.                n = properties.length();
  295.                i = 0;
  296.                while(i < n)
  297.                {
  298.                   p = properties[i].name();
  299.                   if(excludeObject[p] != 1)
  300.                   {
  301.                      propertyNames.push(new QName("","@" + p));
  302.                   }
  303.                   i++;
  304.                }
  305.             }
  306.             else
  307.             {
  308.                n = properties.length();
  309.                uris = options.uris;
  310.                i = 0;
  311.                while(i < n)
  312.                {
  313.                   prop = properties[i];
  314.                   p = prop.@name.toString();
  315.                   uri = prop.@uri.toString();
  316.                   if(excludeObject[p] != 1)
  317.                   {
  318.                      if(!(!options.includeTransient && internalHasMetadata(metadataInfo,p,"Transient")))
  319.                      {
  320.                         if(uris != null)
  321.                         {
  322.                            if(uris.length == 1 && uris[0] == "*")
  323.                            {
  324.                               qName = new QName(uri,p);
  325.                               try
  326.                               {
  327.                                  obj[qName];
  328.                                  propertyNames.push();
  329.                               }
  330.                               catch(e:Error)
  331.                               {
  332.                               }
  333.                            }
  334.                            else
  335.                            {
  336.                               j = 0;
  337.                               while(j < uris.length)
  338.                               {
  339.                                  uri = uris[j];
  340.                                  if(prop.@uri.toString() == uri)
  341.                                  {
  342.                                     qName = new QName(uri,p);
  343.                                     try
  344.                                     {
  345.                                        obj[qName];
  346.                                        propertyNames.push(qName);
  347.                                     }
  348.                                     catch(e:Error)
  349.                                     {
  350.                                     }
  351.                                  }
  352.                                  j++;
  353.                               }
  354.                            }
  355.                         }
  356.                         else if(uri.length == 0)
  357.                         {
  358.                            qName = new QName(uri,p);
  359.                            try
  360.                            {
  361.                               obj[qName];
  362.                               propertyNames.push(qName);
  363.                            }
  364.                            catch(e:Error)
  365.                            {
  366.                            }
  367.                         }
  368.                      }
  369.                   }
  370.                   i++;
  371.                }
  372.             }
  373.          }
  374.          propertyNames.sort(Array.CASEINSENSITIVE | (!!numericIndex ? Array.NUMERIC : 0));
  375.          if(!isDict)
  376.          {
  377.             i = 0;
  378.             while(i < propertyNames.length - 1)
  379.             {
  380.                if(propertyNames[i].toString() == propertyNames[i + 1].toString())
  381.                {
  382.                   propertyNames.splice(i,1);
  383.                   i--;
  384.                }
  385.                i++;
  386.             }
  387.          }
  388.          if(!dynamic)
  389.          {
  390.             cacheKey = getCacheKey(obj,excludes,options);
  391.             CLASS_INFO_CACHE[cacheKey] = result;
  392.          }
  393.          return result;
  394.       }
  395.       
  396.       private static function arrayCompare(param1:Array, param2:Array, param3:int, param4:int, param5:Dictionary) : int
  397.       {
  398.          var _loc7_:* = null;
  399.          var _loc6_:int = 0;
  400.          if(param1.length != param2.length)
  401.          {
  402.             if(param1.length < param2.length)
  403.             {
  404.                _loc6_ = -1;
  405.             }
  406.             else
  407.             {
  408.                _loc6_ = 1;
  409.             }
  410.          }
  411.          else
  412.          {
  413.             for(_loc7_ in param1)
  414.             {
  415.                if(!param2.hasOwnProperty(_loc7_))
  416.                {
  417.                   return -1;
  418.                }
  419.                if((_loc6_ = internalCompare(param1[_loc7_],param2[_loc7_],param3,param4,param5)) != 0)
  420.                {
  421.                   return _loc6_;
  422.                }
  423.             }
  424.             for(_loc7_ in param2)
  425.             {
  426.                if(!param1.hasOwnProperty(_loc7_))
  427.                {
  428.                   return 1;
  429.                }
  430.             }
  431.          }
  432.          return _loc6_;
  433.       }
  434.       
  435.       public static function stringCompare(param1:String, param2:String, param3:Boolean = false) : int
  436.       {
  437.          if(param1 == null && param2 == null)
  438.          {
  439.             return 0;
  440.          }
  441.          if(param1 == null)
  442.          {
  443.             return 1;
  444.          }
  445.          if(param2 == null)
  446.          {
  447.             return -1;
  448.          }
  449.          if(param3)
  450.          {
  451.             param1 = param1.toLocaleLowerCase();
  452.             param2 = param2.toLocaleLowerCase();
  453.          }
  454.          var _loc4_:int;
  455.          if((_loc4_ = param1.localeCompare(param2)) < -1)
  456.          {
  457.             _loc4_ = -1;
  458.          }
  459.          else if(_loc4_ > 1)
  460.          {
  461.             _loc4_ = 1;
  462.          }
  463.          return _loc4_;
  464.       }
  465.       
  466.       public static function dateCompare(param1:Date, param2:Date) : int
  467.       {
  468.          if(param1 == null && param2 == null)
  469.          {
  470.             return 0;
  471.          }
  472.          if(param1 == null)
  473.          {
  474.             return 1;
  475.          }
  476.          if(param2 == null)
  477.          {
  478.             return -1;
  479.          }
  480.          var _loc3_:Number = param1.getTime();
  481.          var _loc4_:Number = param2.getTime();
  482.          if(_loc3_ < _loc4_)
  483.          {
  484.             return -1;
  485.          }
  486.          if(_loc3_ > _loc4_)
  487.          {
  488.             return 1;
  489.          }
  490.          return 0;
  491.       }
  492.       
  493.       public static function numericCompare(param1:Number, param2:Number) : int
  494.       {
  495.          if(isNaN(param1) && isNaN(param2))
  496.          {
  497.             return 0;
  498.          }
  499.          if(isNaN(param1))
  500.          {
  501.             return 1;
  502.          }
  503.          if(isNaN(param2))
  504.          {
  505.             return -1;
  506.          }
  507.          if(param1 < param2)
  508.          {
  509.             return -1;
  510.          }
  511.          if(param1 > param2)
  512.          {
  513.             return 1;
  514.          }
  515.          return 0;
  516.       }
  517.       
  518.       private static function newline(param1:String, param2:int = 0) : String
  519.       {
  520.          var _loc3_:* = param1;
  521.          _loc3_ += "\n";
  522.          var _loc4_:int = 0;
  523.          while(_loc4_ < param2)
  524.          {
  525.             _loc3_ += " ";
  526.             _loc4_++;
  527.          }
  528.          return _loc3_;
  529.       }
  530.       
  531.       private static function getRef(param1:Object, param2:Dictionary) : Object
  532.       {
  533.          var _loc3_:Object = param2[param1];
  534.          while(_loc3_ && _loc3_ != param2[_loc3_])
  535.          {
  536.             _loc3_ = param2[_loc3_];
  537.          }
  538.          if(!_loc3_)
  539.          {
  540.             _loc3_ = param1;
  541.          }
  542.          if(_loc3_ != param2[param1])
  543.          {
  544.             param2[param1] = _loc3_;
  545.          }
  546.          return _loc3_;
  547.       }
  548.       
  549.       private static function recordMetadata(param1:XMLList) : Object
  550.       {
  551.          var prop:XML = null;
  552.          var propName:String = null;
  553.          var metadataList:XMLList = null;
  554.          var metadata:Object = null;
  555.          var md:XML = null;
  556.          var mdName:String = null;
  557.          var argsList:XMLList = null;
  558.          var value:Object = null;
  559.          var arg:XML = null;
  560.          var existing:Object = null;
  561.          var argKey:String = null;
  562.          var argValue:String = null;
  563.          var existingArray:Array = null;
  564.          var properties:XMLList = param1;
  565.          var result:Object = null;
  566.          try
  567.          {
  568.             for each(prop in properties)
  569.             {
  570.                propName = prop.attribute("name").toString();
  571.                metadataList = prop.metadata;
  572.                if(metadataList.length() > 0)
  573.                {
  574.                   if(result == null)
  575.                   {
  576.                      result = {};
  577.                   }
  578.                   metadata = {};
  579.                   result[propName] = metadata;
  580.                   for each(md in metadataList)
  581.                   {
  582.                      mdName = md.attribute("name").toString();
  583.                      argsList = md.arg;
  584.                      value = {};
  585.                      for each(arg in argsList)
  586.                      {
  587.                         argKey = arg.attribute("key").toString();
  588.                         if(argKey != null)
  589.                         {
  590.                            argValue = arg.attribute("value").toString();
  591.                            value[argKey] = argValue;
  592.                         }
  593.                      }
  594.                      existing = metadata[mdName];
  595.                      if(existing != null)
  596.                      {
  597.                         if(existing is Array)
  598.                         {
  599.                            existingArray = existing as Array;
  600.                         }
  601.                         else
  602.                         {
  603.                            existingArray = [existing];
  604.                            delete metadata[mdName];
  605.                         }
  606.                         existingArray.push(value);
  607.                         existing = existingArray;
  608.                      }
  609.                      else
  610.                      {
  611.                         existing = value;
  612.                      }
  613.                      metadata[mdName] = existing;
  614.                   }
  615.                }
  616.             }
  617.          }
  618.          catch(e:Error)
  619.          {
  620.          }
  621.          return result;
  622.       }
  623.       
  624.       public static function compare(param1:Object, param2:Object, param3:int = -1) : int
  625.       {
  626.          return internalCompare(param1,param2,0,param3,new Dictionary(true));
  627.       }
  628.       
  629.       private static function listCompare(param1:IList, param2:IList, param3:int, param4:int, param5:Dictionary) : int
  630.       {
  631.          var _loc7_:int = 0;
  632.          var _loc6_:int = 0;
  633.          if(param1.length != param2.length)
  634.          {
  635.             if(param1.length < param2.length)
  636.             {
  637.                _loc6_ = -1;
  638.             }
  639.             else
  640.             {
  641.                _loc6_ = 1;
  642.             }
  643.          }
  644.          else
  645.          {
  646.             _loc7_ = 0;
  647.             while(_loc7_ < param1.length)
  648.             {
  649.                if((_loc6_ = internalCompare(param1.getItemAt(_loc7_),param2.getItemAt(_loc7_),param3 + 1,param4,param5)) != 0)
  650.                {
  651.                   _loc7_ = param1.length;
  652.                }
  653.                _loc7_++;
  654.             }
  655.          }
  656.          return _loc6_;
  657.       }
  658.       
  659.       private static function internalCompare(param1:Object, param2:Object, param3:int, param4:int, param5:Dictionary) : int
  660.       {
  661.          var newDepth:int = 0;
  662.          var aRef:Object = null;
  663.          var bRef:Object = null;
  664.          var aProps:Array = null;
  665.          var bProps:Array = null;
  666.          var isDynamicObject:Boolean = false;
  667.          var propName:QName = null;
  668.          var aProp:Object = null;
  669.          var bProp:Object = null;
  670.          var i:int = 0;
  671.          var a:Object = param1;
  672.          var b:Object = param2;
  673.          var currentDepth:int = param3;
  674.          var desiredDepth:int = param4;
  675.          var refs:Dictionary = param5;
  676.          if(a == null && b == null)
  677.          {
  678.             return 0;
  679.          }
  680.          if(a == null)
  681.          {
  682.             return 1;
  683.          }
  684.          if(b == null)
  685.          {
  686.             return -1;
  687.          }
  688.          if(a is ObjectProxy)
  689.          {
  690.             a = ObjectProxy(a).object_proxy::object;
  691.          }
  692.          if(b is ObjectProxy)
  693.          {
  694.             b = ObjectProxy(b).object_proxy::object;
  695.          }
  696.          var typeOfA:String = typeof a;
  697.          var typeOfB:String = typeof b;
  698.          var result:int = 0;
  699.          if(typeOfA == typeOfB)
  700.          {
  701.             switch(typeOfA)
  702.             {
  703.                case "boolean":
  704.                   result = numericCompare(Number(a),Number(b));
  705.                   break;
  706.                case "number":
  707.                   result = numericCompare(a as Number,b as Number);
  708.                   break;
  709.                case "string":
  710.                   result = stringCompare(a as String,b as String);
  711.                   break;
  712.                case "object":
  713.                   newDepth = desiredDepth > 0 ? int(desiredDepth - 1) : int(desiredDepth);
  714.                   aRef = getRef(a,refs);
  715.                   bRef = getRef(b,refs);
  716.                   if(aRef == bRef)
  717.                   {
  718.                      return 0;
  719.                   }
  720.                   refs[bRef] = aRef;
  721.                   if(desiredDepth != -1 && currentDepth > desiredDepth)
  722.                   {
  723.                      result = stringCompare(a.toString(),b.toString());
  724.                   }
  725.                   else if(a is Array && b is Array)
  726.                   {
  727.                      result = arrayCompare(a as Array,b as Array,currentDepth,desiredDepth,refs);
  728.                   }
  729.                   else if(a is Date && b is Date)
  730.                   {
  731.                      result = dateCompare(a as Date,b as Date);
  732.                   }
  733.                   else if(a is IList && b is IList)
  734.                   {
  735.                      result = listCompare(a as IList,b as IList,currentDepth,desiredDepth,refs);
  736.                   }
  737.                   else if(a is ByteArray && b is ByteArray)
  738.                   {
  739.                      result = byteArrayCompare(a as ByteArray,b as ByteArray);
  740.                   }
  741.                   else
  742.                   {
  743.                      if(getQualifiedClassName(a) != getQualifiedClassName(b))
  744.                      {
  745.                         return 1;
  746.                      }
  747.                      aProps = getClassInfo(a).properties;
  748.                      isDynamicObject = true;
  749.                      try
  750.                      {
  751.                         a["wootHackwoot"];
  752.                      }
  753.                      catch(e:Error)
  754.                      {
  755.                         isDynamicObject = false;
  756.                      }
  757.                      if(isDynamicObject)
  758.                      {
  759.                         bProps = getClassInfo(b).properties;
  760.                         result = arrayCompare(aProps,bProps,currentDepth,newDepth,refs);
  761.                         if(result != 0)
  762.                         {
  763.                            return result;
  764.                         }
  765.                      }
  766.                      i = 0;
  767.                      while(i < aProps.length)
  768.                      {
  769.                         propName = aProps[i];
  770.                         aProp = a[propName];
  771.                         bProp = b[propName];
  772.                         result = internalCompare(aProp,bProp,currentDepth + 1,newDepth,refs);
  773.                         if(result != 0)
  774.                         {
  775.                            return result;
  776.                         }
  777.                         i++;
  778.                      }
  779.                   }
  780.                   break;
  781.             }
  782.             return result;
  783.          }
  784.          return stringCompare(typeOfA,typeOfB);
  785.       }
  786.       
  787.       public static function hasMetadata(param1:Object, param2:String, param3:String, param4:Array = null, param5:Object = null) : Boolean
  788.       {
  789.          var _loc6_:Object;
  790.          var _loc7_:Object = (_loc6_ = getClassInfo(param1,param4,param5))["metadata"];
  791.          return internalHasMetadata(_loc7_,param2,param3);
  792.       }
  793.       
  794.       private static function internalHasMetadata(param1:Object, param2:String, param3:String) : Boolean
  795.       {
  796.          var _loc4_:Object = null;
  797.          if(param1 != null)
  798.          {
  799.             if((_loc4_ = param1[param2]) != null)
  800.             {
  801.                if(_loc4_[param3] != null)
  802.                {
  803.                   return true;
  804.                }
  805.             }
  806.          }
  807.          return false;
  808.       }
  809.       
  810.       public static function toString(param1:Object, param2:Array = null, param3:Array = null) : String
  811.       {
  812.          if(param3 == null)
  813.          {
  814.             param3 = defaultToStringExcludes;
  815.          }
  816.          refCount = 0;
  817.          return internalToString(param1,0,null,param2,param3);
  818.       }
  819.       
  820.       private static function byteArrayCompare(param1:ByteArray, param2:ByteArray) : int
  821.       {
  822.          var _loc4_:int = 0;
  823.          var _loc3_:int = 0;
  824.          if(param1 == param2)
  825.          {
  826.             return _loc3_;
  827.          }
  828.          if(param1.length != param2.length)
  829.          {
  830.             if(param1.length < param2.length)
  831.             {
  832.                _loc3_ = -1;
  833.             }
  834.             else
  835.             {
  836.                _loc3_ = 1;
  837.             }
  838.          }
  839.          else
  840.          {
  841.             _loc4_ = 0;
  842.             while(_loc4_ < param1.length)
  843.             {
  844.                _loc3_ = numericCompare(param1[_loc4_],param2[_loc4_]);
  845.                if(_loc3_ != 0)
  846.                {
  847.                   _loc4_ = param1.length;
  848.                }
  849.                _loc4_++;
  850.             }
  851.          }
  852.          return _loc3_;
  853.       }
  854.       
  855.       public static function copy(param1:Object) : Object
  856.       {
  857.          var _loc2_:ByteArray = new ByteArray();
  858.          _loc2_.writeObject(param1);
  859.          _loc2_.position = 0;
  860.          return _loc2_.readObject();
  861.       }
  862.       
  863.       private static function getCacheKey(param1:Object, param2:Array = null, param3:Object = null) : String
  864.       {
  865.          var _loc5_:uint = 0;
  866.          var _loc6_:String = null;
  867.          var _loc7_:* = null;
  868.          var _loc8_:String = null;
  869.          var _loc4_:String = getQualifiedClassName(param1);
  870.          if(param2 != null)
  871.          {
  872.             _loc5_ = 0;
  873.             while(_loc5_ < param2.length)
  874.             {
  875.                if((_loc6_ = param2[_loc5_] as String) != null)
  876.                {
  877.                   _loc4_ += _loc6_;
  878.                }
  879.                _loc5_++;
  880.             }
  881.          }
  882.          if(param3 != null)
  883.          {
  884.             for(_loc7_ in param3)
  885.             {
  886.                _loc4_ += _loc7_;
  887.                if((_loc8_ = param3[_loc7_] as String) != null)
  888.                {
  889.                   _loc4_ += _loc8_;
  890.                }
  891.             }
  892.          }
  893.          return _loc4_;
  894.       }
  895.    }
  896. }
  897.